<?php

namespace addons\kzvote\controller;

use app\common\model\kzvote\Notice as NoticeModel;

class Notice extends Base
{
    protected $noNeedLogin = ['index','detail'];

    public function index()
    {
        $model = new NoticeModel;
        $list = $model->field('id,name,createtime')->order('weigh desc')->paginate(10,true);
        $this->success('',$list);
    }

    public function detail()
    {
        $id = $this->request->param('id');
        $info = NoticeModel::get($id);
        if (!$info){
            $this->error('数据不存在');
        }
        $this->success('',$info);
    }

}
